package com.java.star.mall.front.pojo.param;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * 订单新增参数类
 */
@Data
public class OrderParam implements Serializable {

    private static final long serialVersionUID = -8096152095325831429L;

    @ApiModelProperty(value = "收货地址id")
    @NotNull(message = "收货地址id不能为空")
    private Integer addressId;

    @Valid
    @ApiModelProperty(value = "商品项")
    @NotEmpty(message = "商品项不能为空")
    private List<OrderItemParam> orderItems;

    @ApiModelProperty(value = "总价")
    @NotNull(message = "总价不能为空")
    private BigDecimal total;

    @ApiModelProperty(value = "防重令牌")
    @NotEmpty(message = "防重令牌不能为空")
    private String orderToken;

    @ApiModelProperty(value = "购买类型", notes = "0：购物车购买 1:立即购买")
    @NotEmpty(message = "购买类型不能为空")
    @Pattern(regexp = "^([01])$", message = "购买类型值不合法")
    private String orderType;
}
